package com.youkeda.yikao.web.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author ：xiong
 * @date ：Created in 2019/9/1 15:14
 * @description：拦截器的实现
 * @modified By：
 */
@Configuration
public class LoginWebMvcConfigurer implements WebMvcConfigurer {
    //通过依赖注入，实例化一个登录的拦截器
    @Autowired
    private AuthHanderInterceptor authHanderInterceptor;
    //注册拦截器

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //素有的请求都要经过这里
        registry.addInterceptor(authHanderInterceptor).addPathPatterns("/**");
    }
}
